<template>
	<view class="all">
		 <view class="shibai">失败</view>
		  <view class="douzi">-{{douzi}}</view>
		  <button class="xiayiba" type="primary" @click="xiayiba">下一把</button> 
	</view>
</template>

<script>
	export default {
		data() {
			return {
				douzi:0,
				fangjianid:0,
				xuhao:0,
				zhang:""
			}
		},
		async created(){
			this.fangjianid=getApp().globalData.fangjianid
			this.xuhao=getApp().globalData.xuhao
				this.zhang=getApp().globalData.zhang
			uni.request({
				url:"http://localhost:8080/wanfa/fangjianxinxi",
				data:{fangjianid:this.fangjianid},
				success: (res) => {
					if(res.data.dizhu==this.xuhao)
					this.douzi=res.data.jiesuandou
					else
					this.douzi=res.data.jiesuandou/2
				}
			})
			await new Promise((res)=>setTimeout(res,500))
			uni.request({
				url:"http://localhost:8080/jbgn/lingjindou",
				data:{zhang:this.zhang,jindou:-this.douzi}
			})
		},
		methods: {
			xiayiba(){
				uni.redirectTo({
					url:"/pages/index/wanfa/pipei"
				})
			}
		}
	}
</script>

<style>
.all{
	 position: absolute;
	 width: 350rpx;
	 height: 250rpx;
	 background-color: antiquewhite;
	 left: 50%;
	 top: 50%;
	 transform: translate(-50%,-50%);
	 display: flex;
	 flex-direction: column;
	 align-items: center;
 }
 .shibai{
	 font-size: 30rpx;
	 margin-top: 20rpx;
 }
 .douzi{
	 margin-top: 40rpx;
 }
 .xiayiba{
	 margin-top: 50rpx;
 }
</style>
